package com.typy.www.tpay.ui.itemview;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.android.volley.toolbox.ImageLoader;
import com.bumptech.glide.Glide;
import com.typy.www.tpay.R;
import com.typy.www.tpay.bean.bean.HomeBtnBean;
import com.typy.www.tpay.ui.acitivity.ImageActivity;
import com.typy.www.tpay.ui.acitivity.ImageBrowserActivity;
import com.typy.www.tpay.util.CacheImageLoad;
import com.typy.www.tpay.util.GlideUtils;
import com.typy.www.tpay.util.LoadImage;
import com.typy.www.tpay.util.LocalDisplay;
import com.typy.www.tpay.util.Logutil;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by 13799 on 2018/7/29.
 */

public class PictureItemView {
    private View mView;
    Context mContext;
    ViewHolder holder;
    private int type;

    public View getmView() {
        return mView;
    }

    public PictureItemView(Context context) {
        mContext = context;
        mView = LayoutInflater.from(context).inflate(R.layout.item_imageviews, null);
        holder = new ViewHolder(mView);
    }

    public void bind(final HomeBtnBean bean) {
        GlideUtils.setImage(mContext,bean.getBtnName(),holder.img);
        holder.img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ImageActivity.show(mContext,bean.getBtnName());
            }
        });
//        Glide.with(mContext).load(bean.getBtnName()).into(holder.img);
    }

    static class ViewHolder {
        @BindView(R.id.img)
        ImageView img;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
